﻿
@{
    ViewBag.Title = "HiddenTroubleAdd";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}
@section css {
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <style>
        th {
            text-align: center;
            font-weight: bold;
        }

        td {
            text-align: center;
            vertical-align: middle;
        }
    </style>
}
<div class="page-content" ng-cloak ng-controller="HiddenTroubleController" ng-init="FormId='@(Request.QueryString["FormId"].IsEmpty() ? "0" : Request.QueryString["FormId"])';
     SolutionId='@(Request.QueryString["SolutionId"].IsEmpty() ? "0" : Request.QueryString["SolutionId"])';
     page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     pagename='@(Request.QueryString["pagename"].IsEmpty() ? "HiddenTroubleRectification" : Request.QueryString["pagename"])';
     GetFactoryArea();
     BindDepartmentList('Dep_Select');
     GetHiddenTroubleType();
     GetHiddenTroubleState();
     GetEquTypeList();
     GetDepartmentList();
     GetHiddenTroubleEditDetail(FormId);
     GetSolutionEditDetail(SolutionId);

     ">
    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />

			</path>
		</svg>
            <div class="load-msg" ng-bind="LoadingMsg"></div>
        </div>
    </div>
    <div class="page-heading">
        <h1>编辑解决措施</h1>
        <div class="options">
            <div class="btn-toolbar">

            </div>
        </div>
    </div>
    <ol class="breadcrumb">
        <li><a>主页</a></li>
        <li><a>问题治理</a></li>
        <li><a>问题台账</a></li>
        <li class="active"><a>编辑解决措施</a></li>
    </ol>
    <form id="HiddenTroubleForm" class="form-horizontal row-border">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div id="basicinfo" class="panel panel-midnightblue">
                        <div class="panel-heading"><h2>问题基本信息</h2></div>
                        <div class="panel-body">

                            <div class="form-group">
                                <label class="col-sm-1 control-label">编号：</label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control" placeholder="编号" ng-model="HiddenTroubleEditModel.FormNo" disabled />
                                </div>
                                <label class="col-sm-1 control-label">园区：</label>
                                <div class="col-sm-2">
                                    <select ng-model="HiddenTroubleEditModel.FactoryAreaId" ng-change="" class="form-control" disabled>
                                        <option value="">请选择园区</option>
                                        <option ng-repeat="x in FactoryArea" value="{{x.Id}}">{{x.FactoryAreaName}}</option>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label">责任部门：</label>
                                <div class="col-sm-2">
                                    <select disabled id="Dep_Select" class="selectpicker show-tick form-control" ng-model="HiddenTroubleEditModel.DepartmentId" ng-change="GetTeamListByDepartment(HiddenTroubleEditModel.DepartmentId);GetEmployeeByDepartment(HiddenTroubleEditModel.DepartmentId);" data-live-search="true">
                                        <option value="0">请选择责任部门</option>
                                    </select>
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">问题分类：</label>
                                <div class="col-sm-2" id="div_typeselect">
                                    <select disabled ng-model="HiddenTroubleEditModel.HiddenTroubleCategoryId" ng-change="GetHiddenTroubleTypeChild(AddModel.HiddenTroubleCategoryId,'div_typeselect');" class="form-control">
                                        <option value="">请选择问题分类</option>
                                        <option ng-repeat="x in CategoryList" value="{{x.Id}}">{{x.TypeName}}</option>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label">问题子类：</label>
                                <div class="col-sm-2" id="div_typeselect">
                                    <select disabled ng-model="HiddenTroubleEditModel.TypeId" class="form-control">
                                        <option value="">请选择问题子类</option>
                                        <option ng-repeat="x in CategoryChildList" value="{{x.Id}}">{{x.TypeName}}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">检查时间：</label>
                                <div class="col-sm-2">
                                    <input disabled id="startTime" class="form-control" ng-model="HiddenTroubleEditModel.CheckTime" />
                                </div>
                                <label class="col-sm-1 control-label">地点/部位：</label>
                                <div class="col-sm-2">
                                    <input disabled type="text" class="form-control" placeholder="地点/部位" ng-model="HiddenTroubleEditModel.Location" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">问题描述：</label>
                                <div class="col-sm-8">
                                    <textarea disabled class="form-control autosize" ng-model="HiddenTroubleEditModel.Description" style="overflow: hidden; overflow-wrap: break-word; resize: horizontal; height: 60px;"></textarea>
                                </div>
                            </div>
                            <div class="form-group" style="display:none;">
                                <label class="col-sm-1 control-label">文件列表：</label>
                                <div class="col-sm-8">
                                    <table class="table table-striped table-bordered table-hover">
                                        <thead>
                                            <tr>
                                                <th style="width:5%">序号</th>
                                                <th style="width:30%">文件名称</th>
                                                <th style="width:10%">文件大小(kb)</th>
                                                <th style="width:10%">操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr ng-show="HiddenTroubleEditModel.FileList.length==0">
                                                <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                            </tr>
                                            <tr ng-repeat="x in HiddenTroubleEditModel.FileList">
                                                <td ng-bind="$index+1"></td>
                                                <td ng-bind="x.FileName"></td>
                                                <td ng-bind="x.FileSize"></td>
                                                <td>
                                                    <a href="../Download/DownloadFile?FileId={{x.FileId}}" class="btn btn-success btn-xs btn-label"><i class="fa fa-download"></i>下载</a>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-sky">
                        <div class="panel-heading">
                            <h2>问题整改措施</h2>
                            <div class="panel-ctrls">
                                <div class="btn-group">

                                </div>
                            </div>
                        </div>
                        <div class="panel-body" id="SolutionItems">
                            <div>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">设施设备类型：</label>
                                    <div class="col-sm-2">
                                        <select ng-model="SolutionEditModel.EquType" ng-change="GetMaintanceDep(SolutionEditModel.EquType,SolutionEditModel);" class="form-control">
                                            <option value="" selected>请选择设施设备类型</option>
                                            <option value="0">非设施设备类问题</option>
                                            <option ng-repeat="x in EquTypeList" value="{{x.Id}}">{{x.TypeName}}</option>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">设备维保部门：</label>
                                    <div class="col-sm-2">
                                        <select ng-model="SolutionEditModel.DepartmentId" ng-disabled="SolutionEditModel.EquType==''||SolutionEditModel.EquType=='0'||SolutionEditModel.EquType==null" ng-change="" class="form-control">
                                            <option value="" selected>请选择设备维保部门</option>
                                            <option ng-repeat="x in DepartmentList" value="{{x.Id}}">{{x.DepartmentName}}</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">计划完成时间：</label>
                                    <div class="col-sm-2">
                                        <datepicker id="PlanCompleteTime" option="datetimeOption" format="L" ng-model="SolutionEditModel.PlanCompleteTime"></datepicker>
                                    </div>
                                    @*<label class="col-sm-1 control-label">责任班组：</label>
            <div class="col-sm-2">
                <select ng-model="SolutionEditModel.TeamId" class="form-control">
                    <option value="">请选择班组</option>
                    <option ng-repeat="x in TeamList" value="{{x.TeamId}}">{{x.TeamName}}</option>
                </select>
            </div>*@
                                    <label class="col-sm-1 control-label">联系部门：</label>
                                    <div class="col-sm-2">
                                        <input type="text" class="form-control" ng-model="SolutionEditModel.DepartmentName" />
                                    </div>
                                    <label class="col-sm-1 control-label">联系人：</label>
                                    <div class="col-sm-2">
                                        <input type="text" class="form-control" ng-model="SolutionEditModel.Responsible" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">整改措施：</label>
                                    <div class="col-sm-8">
                                        <textarea class="form-control autosize" ng-model="SolutionEditModel.SolutionContent" style="overflow: hidden; overflow-wrap: break-word; resize: horizontal; height: 80px;"></textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">文件列表：</label>
                                    <div class="col-sm-8">
                                        <table class="table table-striped table-bordered table-hover">
                                            <thead>
                                                <tr>
                                                    <th style="width:5%">序号</th>
                                                    <th style="width:30%">文件名称</th>
                                                    <th style="width:10%">文件大小(kb)</th>
                                                    <th style="width:10%">操作</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr ng-show="SolutionEditModel.FileList.length==0">
                                                    <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                                </tr>
                                                <tr ng-repeat="x in SolutionEditModel.FileList">
                                                    <td ng-bind="$index+1"></td>
                                                    <td ng-bind="x.FileName"></td>
                                                    <td ng-bind="x.FileSize"></td>
                                                    <td>
                                                        <a href="../Download/DownloadFile?FileId={{x.FileId}}" class="btn btn-success btn-xs btn-label"><i class="fa fa-download"></i>下载</a>
                                                        <a ng-click="DeleteSolutionFile(x.Id,SolutionEditModel.FileList);" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash-o"></i>删除</a>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">上传文件:</label>
                                    <div class="col-lg-8">
                                        <input type="file" class="form-control" style="border:none;" id="SolutionFile" multiple>
                                    </div>
                                </div>
                            </div>
                        </div>                        
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-12">
                    <div class="form-group">
                        <div class="col-sm-6 col-sm-offset-2">
                            <button class="btn-primary btn" ng-click="EditSolution(SolutionId,SolutionEditModel,pagename,page);">保存</button>
                            <a href="{{pagename}}?page={{page}}" class="btn-default btn">返回</a>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </form>
</div>


@section Js{
    <script src="~/Assets/js/pg/HiddenTrouble.js"></script>
    <script src="~/Assets/js/libs/moment.min.js"></script>
    <script src="~/Assets/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Assets/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Assets/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Assets/js/libs/fileinput.js"></script>
    <script src="~/Assets/js/libs/zh.js"></script>
    <script>
        $('#docfiles').fileinput({
            language: 'zh'
        });
        
    </script>
}